package com.halflife;

import com.halflife.framework.interceptor.GlobleVariableInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

/**
 * Created by zhaoyf on 2018/3/4.
 */
@Configuration
public class WebConfig implements WebMvcConfigurer{
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/xx").setViewName("index");
        registry.addViewController("/yy").setViewName("redirect:/admin/login");
        registry.addViewController("/").setViewName("redirect:/admin/login");
        registry.addViewController("").setViewName("redirect:/admin/login");
    }

    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new GlobleVariableInterceptor()).addPathPatterns("/admin/**").addPathPatterns("/svg/operate/**");
//        registry.addInterceptor(new GlobleVariableInterceptor()).addPathPatterns("/admin/**").excludePathPatterns("/admin/login");
    }
}
